package com.atguigu.common.exception;

import com.atguigu.common.result.ResponseEnum;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
public class BusinessException extends RuntimeException{
    //状态码
    private Integer code;
    //错误消息
    private String message;
    //错误消息
    public BusinessException(String message){
        this.message=message;
    }
    //错误消息
    public BusinessException(String message,Integer code){
        this.message=message;
        this.code=code;
    }
    public BusinessException(String message,Integer code,Throwable cause){
        super(cause);
        this.message=message;
        this.code=code;
    }
    public BusinessException(ResponseEnum responseEnum){
        this.message=responseEnum.getMessage();
        this.code=responseEnum.getCode();
    }
    public BusinessException(ResponseEnum resultCodeEnum,Throwable cause){
        super(cause);
        this.message=resultCodeEnum.getMessage();
        this.code=resultCodeEnum.getCode();
    }
}
